package com.ht.WeNas.data.dto;

import com.ht.WeNas.data.entity.User;
import com.ht.WeNas.data.enumObj.UserType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "用户数据传输")
public class UserDto {
    @Schema(description = "用户id")
    String id;

    @Schema(description = "用户名")
    String username;

    @Schema(description = "用户类型")
    UserType userType;
    
    @Schema(description = "创建时间")
    LocalDateTime createTime;
    
    @Schema(description = "更新时间")
    LocalDateTime updateTime;
    
    public UserDto() {}
    
    public UserDto(User user) {
        this.id = Long.toString(user.getId());
        this.username = user.getUsername();
        this.userType = user.getUserType();
        this.createTime = user.getCreateTime();
        this.updateTime = user.getUpdateTime();
    }
}
